package com.doc.desensitization.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.doc.desensitization.common.utils.DesensitizationType;
import com.doc.desensitization.common.utils.Desensitize;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户实体类
 */
@Data
@TableName("USER_INFO")  // 使用反引号转义表名
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID，自增主键
     */
    private Long id;

    /**
     * 用户姓名
     */
    private String name;

    /**
     * 手机号码
     */
    @Desensitize(type = DesensitizationType.PHONE, prefixLength = 3, suffixLength = 4)

    private String phone;

    /**
     * 电子邮箱
     */
    @Desensitize(type = DesensitizationType.EMAIL, prefixLength = 1, suffixLength = 0)

    private String email;

    /**
     * 身份证号码
     */
    @Desensitize(type = DesensitizationType.ID_CARD, prefixLength = 6, suffixLength = 4)

    private String idCard;

    /**
     * 家庭住址
     */
    @Desensitize(type = DesensitizationType.ADDRESS, prefixLength = 6, suffixLength = 0)

    private String address;

    /**
     * 银行卡号
     */
    @Desensitize(type = DesensitizationType.BANK_CARD, prefixLength = 4, suffixLength = 4)

    private String bankCard;

    /**
     * 记录创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

    private Date createTime;

    /**
     * 记录更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}